;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(define Stables
        (zone (name Stable) (players Cho)
              (positions CS1 CS2 CS3 CS4) ) ;-- end Cho Stables zone
        (zone (name Stable) (players Han)
              (positions HS10 HS9 HS8 HS7) ) ;-- end Han Stables zone
        ) ;-- end Stables definition

;++  The holding area or 'stables' for the Horses and Elephants of both sides.
;++  To start the game, the players move their Horse and Elephant pieces from
;++  these spaces onto the playing board proper.  These spaces have no other
;++  function in a game.

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(define Empty-Pens
(kill-positions CS5 CS6 CS7 CS8 CS9 CS10
                HS1 HS2 HS3 HS4 HS5 HS6
                y1 y2 y3 y4 y5 y6 y7 y8 y9 y10
                z1 z2 z3 z4 z5 z6 z7 z8 z9 z10                
                ) ;-- end kill-positions
        ) ;-- end EmptyPens definition

;++  These are 'spaces' to be ignored on the board.  Dead spaces around the 
;++  board proper and the holding area or 'stables' for Horses and Elephants
;++  to be dropped from at the beginning of a game.

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(define Fortresses
       (links fortress-ne (d1 e2)(e2 f3) (d8 e9)(e9 f10))
       (links fortress-sw (e2 d1)(f3 e2) (e9 d8)(f10 e9))
       (links fortress-nw (f1 e2)(e2 d3) (f8 e9)(e9 d10))
       (links fortress-se (e2 f1)(d3 e2) (e9 f8)(d10 e9))
       (symmetry Han (n s)(s n) (nw sw)(sw nw) (ne se)(se ne)
                 (fortress-ne fortress-se)(fortress-se fortress-ne)
                 (fortress-nw fortress-sw)(fortress-sw fortress-nw))
       (zone (name fortress)
             (players Cho)
             (positions d1 e1 f1 d2 e2 f2 d3 e3 f3))
       (zone (name fortress)
             (players Han)
             (positions d10 e10 f10 d9 e9 f9 d8 e8 f8)) 
        ) ;-- end Fortresses definition

;++  The diagonal movement inside the fortress the fortress nees a little bit
;++  of special treatment.  The diagonals only radiate out from the centre
;++  point of the fortress, so it is not unlimited diagonal movement within
;++  the fortress, as such.

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(define Prepare-Board
        (board (image "Images\Janggi\Janggi Board.bmp")
               (grid (start-rectangle 6 5 46 47)
                     (dimensions ("HS/y/a/b/c/d/e/f/g/h/i/z/CS" (45 0)) ; files
                                 ("10/9/8/7/6/5/4/3/2/1" (0 45)) ; ranks
                                 ) ;-- end dimensions
                     (directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0)
                                 (ne 1 -1) (nw -1 -1) (se 1 1) (sw -1 1))
                     ) ;-- end grid
               (Empty-Pens) ; define ignored spaces
               (Fortresses) ; define the players' fortresses
               (Stables)    ; define the areas Horse and Elephant pieces start
               (unlink CS1 CS2 CS3 CS4 HS10 HS9 HS8 HS7)
               ) ;-- end board definition.
        ) ;-- end Prepare-Board definition

;+++  NOTE on the file lables:
;+++       CS = "Cho Stable" (most of which won't be used anyway)
;+++       HS = "Han Stable" (most of which won't be used anyway)
;+++       y, z = dead/buffer zone

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

